package com.ruoyi.quartz.task;

import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.demo.service.IMesBindTaskDataService;
import com.ruoyi.demo.service.JiandaoyunService;
import com.ruoyi.demo.vo.SnWareHouseDataVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author: SHC
 * @date: 2025/9/28 15:53
 * @Description:
 */
@Slf4j
@Component("jdySendData")
public class JdySendData {

    @Resource
    private JiandaoyunService jiandaoyunService;
    @Autowired
    private IMesBindTaskDataService mesBindTaskDataService;


    public void batchSendToJdy() {
        List<SnWareHouseDataVo> dataList=mesBindTaskDataService.selectSnWareHouseList();

        List<String> needSendSnList = dataList.stream().map(SnWareHouseDataVo::getSn).collect(Collectors.toList());
        log.info("需要发送简道云的SN List：{}", JSONUtil.toJsonStr(dataList));
        String response = jiandaoyunService.batchSendToJdy(dataList);
        log.info("成功发送返回的简道云数据", response);
    }
}

